package net.sf.nlp.segment;

public class Pos implements Cloneable
{
	private long tag;
	private double freq;
	private Pos bestPrePos;
	
	public Pos(long tag, double freq)
	{
		this.tag = tag;
		this.freq = freq;
	}

	public long getTag() {
		return tag;
	}

	public void setTag(long tag) {
		this.tag = tag;
	}

	public double getFreq() {
		return freq;
	}

	public void setFreq(double freq) {
		this.freq = freq;
	}

	public Pos getBestPrePos() {
		return bestPrePos;
	}

	public void setBestPrePos(Pos bestPrePos) {
		this.bestPrePos = bestPrePos;
	}

	public String toString()
	{
		StringBuffer sb = new StringBuffer();
		
		char ch = (char)(tag / 256);
		sb.append(ch);
		
		ch = (char)(tag % 256);
		if (ch > 0)
			sb.append(ch);
        
        return sb.toString();
	}
	
	@Override
	public Pos clone()
	{
		Pos clonedPos = null;
		
		try 
		{
			clonedPos = (Pos)super.clone();
		} 
		catch (CloneNotSupportedException e) 
		{
			e.printStackTrace();
		}
		
		return clonedPos;
	}
}
